-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core/services/keystore: switch to sqlutil.DataStore #12810
Conversation
I see you updated files related to
|
98d889f
to
2919c97
Compare
2919c97
to
3ac208c
Compare
3ac208c
to
6e7cdd8
Compare
6e7cdd8
to
23004be
Compare
23004be
to
8c7290d
Compare
8c7290d
to
6a01834
Compare
6a01834
to
e1c5253
Compare
e1c5253
to
2ebc5b1
Compare
2ebc5b1
to
d695fde
Compare
d695fde
to
804f45d
Compare
The integration tests are failing on |
804f45d
to
e69cd4e
Compare
e69cd4e
to
0ad0eb5
Compare
551d1d7
to
f2b38f3
Compare
ks := keyStore.Cosmos() | ||
reset := func() { | ||
ctx := context.Background() // Executed during cleanup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it benefit to be testutils.Context(t)
? I'm not 100% on my understanding of how go test cleanup operates, but i've had some friction with debugging tests that hang/fail in cleanup vs in the test execution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No it can't be a normal ctx since we execute it during t.Cleanup, when the context may already be done.
if err := q.Get(state, sql, address, chainID.String()); err != nil { | ||
return errors.Wrap(err, "failed to insert evm_key_state") | ||
if err := ds.GetContext(ctx, state, sql, address, chainID.String()); err != nil { | ||
return errors.Wrap(err, "failed to insert key_state") | ||
} | ||
// consider: do we really need a cache of the keystates? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think we don't 😛
@@ -27,18 +29,20 @@ import ( | |||
func Test_EthKeyStore(t *testing.T) { | |||
t.Parallel() | |||
|
|||
db := pgtest.NewSqlxDB(t) | |||
cfg := configtest.NewTestGeneralConfig(t) | |||
db := sqlutil.WrapDataSource(pgtest.NewSqlxDB(t), logger.Test(t), sqlutil.TimeoutHook(func() time.Duration { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why wrap pgtest.NewSqlxDb(t)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just mimicking production. This is where I debugged the issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's worth a code comment because it's not obvious.
or should the test db impl be changed to return the wrapper?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, in the final PR #12456 I updated cltest at least to use a timeout wrapper. We could consider updating the test funcs to return a wrapped DataSource instead of raw sqlx most places 🤷
@@ -477,7 +480,6 @@ targets: | |||
func TestJobsController_Create_WebhookSpec(t *testing.T) { | |||
app := cltest.NewApplicationEVMDisabled(t) | |||
require.NoError(t, app.Start(testutils.Context(t))) | |||
t.Cleanup(func() { assert.NoError(t, app.Stop()) }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice - i've seen similar cleanup needed in helpers in mercury and llo. Maybe worth creating a ticket to audit (good for a new joiner?)
a44dc6f
to
33be896
Compare
Quality Gate passedIssues Measures |
https://smartcontract-it.atlassian.net/browse/BCF-2978
Requires: